﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" name="viewport" content="width=device-width" />
    <title>生产管理尾纱机</title>
    <link href="../../css/bootstrap.min.css" rel="stylesheet" />
    <script src="../../Content/scripts/jquery-1.11.1.min.js"></script>
    <link href="../../Content/styles/font-awesome.min.css" rel="stylesheet" />
    <link href="../../Content/scripts/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <script src="../../Content/scripts/plugins/jquery-ui/jquery-ui.min.js"></script>
    <link href="../../Content/scripts/bootstrap/bootstrap.min.css" rel="stylesheet" />
    <script src="../../Content/scripts/bootstrap/bootstrap.min.js"></script>
    <link href="../../Content/scripts/plugins/jqgrid/jqgrid.css" rel="stylesheet" />
    <link href="../../Content/styles/learun-ui.css" rel="stylesheet" />
    <script src="../../Content/scripts/plugins/jqgrid/grid.locale-cn.js"></script>
    <script src="../../Content/scripts/plugins/jqgrid/jqgrid.min.js"></script>
    <script src="../../Content/scripts/plugins/tree/tree.js"></script>
    <script src="../../Content/scripts/plugins/validator/validator.js"></script>
    <script src="../../Content/scripts/utils/learun-ui.js"></script>
    <script src="../../Content/scripts/utils/learun-form.js"></script>
    <link href="../../Content/scripts/plugins/bootstrap-table/bootstrap-table.css" rel="stylesheet" />
    <script src="../../Content/scripts/plugins/bootstrap-table/bootstrap-table.js"></script>
    <script src="../../Content/scripts/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
    <script src="../../Content/scripts/plugins/layout/jquery.layout.js"></script>
    <script src="../../My97DatePicker/WdatePicker.js"></script>
    <script src="../../js/highcharts.js"></script>
    <script src="../../js/highcharts-3d.js"></script>
    <script src="../../js/getUrlParam.js"></script>
    <!--<script src="MFGjs.js"></script>-->
    <script src="../CustomerMFGJS.js"></script>
    <script src="../../MFG/MFGjs.js"></script>
    <style type="text/css">
        body {
            margin: 0px;
            margin-top: 10px;
        }

        .form .formTitle {
            width: 150px;
            font-size: 20px;
            padding-bottom: 35px;
        }

        .form .formValue {
            padding-bottom: 25px;
            width: 150px;
        }

        .valuestyle {
            font-size: 20px;
        }

        #title {
            font-size: 30px;
            text-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
        }

        #time {
            font-size: 20px;
            float: right;
            line-height: 50px;
            right: 40px;
            position: fixed;
            color: #65b540;
        }

        @media screen and (min-width:1281px) and (max-width:1440px) {
            .valuestyle {
                font-size: 15px;
            }

            .form .formTitle {
                font-size: 15px;
                padding-bottom: 0px;
            }

            .form .formValue {
                padding-bottom: 0px;
            }
        }

        @media screen and (max-width:1024px) {
            .valuestyle {
                font-size: 15px;
            }

            .form .formTitle {
                font-size: 15px;
                padding-bottom: 0px;
            }

            .form .formValue {
                padding-bottom: 0px;
            }
        }



        @media screen and (min-width:1025px) and (max-width:1280px) {
            .valuestyle {
                font-size: 15px;
            }

            .form .formTitle {
                font-size: 15px;
                padding-bottom: 0px;
            }

            .form .formValue {
                padding-bottom: 0px;
            }
        }

        #info {
            float: right;
            color: #ff0000;
            font-size: 9px;
        }

        a {
            color: skyblue;
            text-decoration: none;
            cursor: pointer;
        }

        span {
            border-radius: 100px;
        }

        .highcharts-subtitle {
            left: 260px;
        }

            .highcharts-subtitle a {
                font-size: 20px;
            }

        #tipStart, #tipEnd {
            opacity: 0;
        }

        /*#container {
                width: 1500px;
                margin: 0 auto;
            }*/
        #kaitingcehtongjitu, #guzhangtongjitu, #weisha_guzhangtongjitu {
            opacity: 0;
            margin-top: 10px;
            /*width: 1500px;*/
            margin: 0 auto;
        }

        #kaitingcehtongjitu, #weisha_kaitingcehtongjitu {
            float: left;
            width: 100%;
        }

        #kaitingcehtongjipie, #weisha_kaitingcehtongjipie {
            opacity: 0;
            float: left;
        }

        #westpanel, #centerpanel, #shengchanwanchengpie, #weishawestpanel, #weishacenterpanel {
            opacity: 0;
        }
    </style>

</head>

<body>
    <div style="text-align: center; height: 50px;">
        <span id="title">尾纱监视信息</span>
        <span id="time"></span>
    </div>
    
    <!--尾纱监视信息-->
    <div id="weishajianshi">
        <div class="panel-Title">
            尾纱监视信息
        </div>
        <table id="tb_weisha_jianshi"></table>
    </div>

    <script>
    var ID = getCookie("CustomerID");
    $(function () {
        getTime()
        //1.初始化Table
        var oTable = new TableInit();
        oTable.InitWeishajianshi();

        //2.初始化Button的点击事件
        var oButtonInit = new ButtonInit();
        oButtonInit.Init();
    });

    var TableInit = function () {
        var oTableInit = new Object();
        var time = $("#time").text();

        //初始化Table 尾纱监视
        oTableInit.InitWeishajianshi = function () {
            $('#tb_weisha_jianshi').bootstrapTable({
                url: '../../MFG/MFGCusha.ashx?Action=getWeishajianshi',         //请求后台的URL（*）
                method: 'POST',                      //请求方式（*）
                contentType: "application/x-www-form-urlencoded",
                toolbar: '#toolbar',                //工具按钮用哪个容器
                striped: true,                      //是否显示行间隔色
                cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                pagination: false,                   //是否显示分页（*）
                sortable: true,                     //是否启用排序
                sortOrder: "asc",                   //排序方式
                queryParams: oTableInit.queryParams1, //参数
                //queryParamsType: "limit", //参数格式,发送标准的RESTFul类型的参数请求
                sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                //pageNumber: 1,                       //初始化加载第一页，默认第一页
                //pageSize: 10,                       //每页的记录行数（*）
                //pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大

                strictSearch: true,
                showColumns: true,                  //是否显示所有的列
                showRefresh: true,                  //是否显示刷新按钮
                minimumCountColumns: 2,             //最少允许的列数
                clickToSelect: true,                //是否启用点击选中行
                height: 600,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
                uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
                showToggle: true,                    //是否显示详细视图和列表视图的切换按钮
                cardView: false,                    //是否显示详细视图
                detailView: false,                   //是否显示父子表

                columns: [{
                    field: 'TaiHao',
                    title: '机台号',
                    sortable: true,
                    width: 60
                }, {
                    field: 'xuanzhuandisu',
                    title: '旋转电机低速'
                }, {
                    field: 'xuanzhuanzhongsu',
                    title: '旋转电机中速'
                }, {
                    field: 'xuanzhuangaosu',
                    title: '旋转电机高速'
                },
                {
                    field: 'shengjiangdisu',
                    title: '升降电机低速'
                }, {
                    field: 'shengjiangzhongsu',
                    title: '升降电机中速'
                }, {
                    field: 'shengjianggaosu',
                    title: '升降电机高速'
                }, {
                    field: 'quguanwei',
                    title: '取管位'
                }, {
                    field: 'quguanweipanduan',
                    title: '取管位判断'
                }, {
                    field: 'zhirogwei',
                    title: '植绒位'
                }, {
                    field: 'shanghuanxiang',
                    title: '上换向位'
                }, {
                    field: 'gongzuochushi',
                    title: '工作初始位'
                }, {
                    field: 'maoshuawei',
                    title: '毛刷位/等待位'
                }, {
                    field: 'fanzhuanquanshu',
                    title: '反转圈数'
                }, {
                    field: 'zhaotoushijian',
                    title: '找头时间'
                }, {
                    field: 'zhaotoucishu',
                    title: '找头次数'
                }, {
                    field: 'xishashijian',
                    title: '吸纱时间'
                }, {
                    field: 'xizhirongcishu',
                    title: '吸植绒次数'
                }, {
                    field: 'youmianlingmin',
                    title: '有棉灵敏度'
                }, {
                    field: 'youguanlingmin',
                    title: '有管灵敏度'
                }, {
                    field: 'banben1',
                    title: '单锭板1版本号'
                }, {
                    field: 'banben2',
                    title: '单锭板2版本号'
                }, {
                    field: 'banben3',
                    title: '单锭板3版本号'
                }, {
                    field: 'PLCbanben',
                    title: 'PLC版本号'
                }]
            });
        };

        oTableInit.queryParams1 = function (params) {
            console.log(params);
            var temp = { //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                CustomerID: ID,
                pageSize: params.limit, //页面大小
                offset: params.offset, //页码
                sort: params.sort, //排序列名
                sortOrder: params.order//排位命令（desc，asc）
            };
            console.log(temp);
            return temp;
        };

        return oTableInit;
    };


    var ButtonInit = function () {
        var oInit = new Object();
        var postdata = {};

        oInit.Init = function () {
            //初始化页面上面的按钮事件
        };

        return oInit;
    };
    /*

* ajax 函数，处理 ajax 请求

* @param function callback 回调函数

* @因为要和服务器交互，所以必须在服务器环境运行，不能在硬盘上直接打开

*/

    function ajax(callback) {

        if (typeof callback != 'function') return;

        var ajaxObject;

        try {

            ajaxObject = new XMLHttpRequest();

        } catch (e) {

            try {

                ajaxObject = new ActiveXObject('Microsoft.XMLHTTP');

            } catch (e) {

            }

        }

        if (!ajaxObject) return;

        if (ajaxObject.overrideMimeType) {

            ajaxObject.overrideMimeType('text/html');

        }

        //location.href可以换成其他url，但必须是同一个站点的链接，并且文件存在

        ajaxObject.open('get', location.href);

        ajaxObject.send(null);

        ajaxObject.onreadystatechange = function () {

            if (ajaxObject.readyState == 4) {

                if (ajaxObject.status == 200) {

                    callback(ajaxObject);

                }

            }

        };

    }

    /*

     * 获取时间并动态刷新

    */

    function getTime() {

        ajax(

            function (ao) {

                //只需要AJAX一次，将服务器时间获取后以毫米为单位保存到一个变量中

                _timestamp = Date.parse(ao.getResponseHeader('Date'));

                _timestamp = _timestamp.toString().match(/^\d$/) ? _timestamp : new Date().getTime();

                //设置定时器每过一秒动态刷新一次时间

                setInterval(

                    function () {

                        //这里可以自定义时间显示格式

                        //document.getElementById('time').innerHTML = new Date(_timestamp)
                        var oDiv = document.getElementById("time");
                        var date = new Date(_timestamp);
                        var year = date.getFullYear();//当前年份
                        var month = date.getMonth();//当前月份
                        var data = date.getDate();//天
                        var hours = date.getHours();//小时
                        var minute = date.getMinutes();//分
                        var second = date.getSeconds();//秒
                        var time = year + "-" + fnW((month + 1)) + "-" + fnW(data) + " " + fnW(hours) + ":" + fnW(minute) + ":" + fnW(second);
                        oDiv.innerHTML = time;
                        _timestamp += 1000;

                    },

                    1000

                );

            }

        );

    }

    window.onload = getTime;

    //读取cookie
    function getCookie(name) {
        var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
        if (arr != null) return decodeURI(arr[2]); return null;
    };

    ////补位 当某个字段不是两位数时补0
    function fnW(str) {
        var num;
        str > 9 ? num = str : num = "0" + str;
        return num;
    }
    </script>


</body>
</html>